package com.zykj.abstractfactory;

import com.zykj.abstractfactory.yuanliao.YuanliaoFactory;
import com.zykj.abstractfactory.yuanliao.china.ChinaYangliaoFactory;
import com.zykj.abstractfactory.yuanliao.ny.NYYuanliaoFactory;

/**
 * @author zhoulj(周利军) [1217102780@qq.com]
 * @Title: ChinaPizzaStore
 * @Project: ${MODEL_NAME}
 * @Module ID:   <(模块)类编号，可以引用系统设计中的类编号>
 * @Comments: <对此类的描述，可以引用系统设计中的描述>
 * @JDK version used:      <JDK1.8> 11
 * @since 2018/12/27-16:11
 */
public class ChinaPizzaStore extends PizzaStore {
    @Override
    public Pizza createPizza(String type) {
        Pizza pizza = null;
        // 这是纽约店 就使用 纽约的原料工厂
        YuanliaoFactory chinaYuanliaoFactory = new ChinaYangliaoFactory();
        if ("cheese".equals(type)) {
            pizza = new CheesePizza(chinaYuanliaoFactory);
            pizza.setName("纽约的奶酪披萨");
        } else if ("hunhe".equals(type)) {
            pizza = new HunhePizza(chinaYuanliaoFactory);
            pizza.setName("纽约的混合披萨");
        }
        return pizza;
    }
}
